//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    dataList:[]
    
  },

  onLoad: function () {
    this.requestDataList();
    

  },
  onShow:function(){
    this.requestDataList();
  },

  requestDataList: function () {
    var that = this;
    wx.showLoading({
      title: '读取中 ',
    })
    wx.request({
      url: app.appSetting.host + "world/GetUserCollectList?userId=" + app.globalData.userInfo.UserId,
      data: {
      },
      header: {
        'content-type': 'application/json' // 默认值
      },
      success: function (res) {

        wx.hideLoading();
        if (res.data.Status == 0) {
          that.setData({
            dataList: res.data.Result
          });
        } else {
          app.showMsg(res.data.Message);
        }

      }
    })
  },
  deleteCollect:function(e){
    console.log(e);
    var that = this;
    wx.showLoading({
      title: '操作中 ',
    })
    wx.request({
      url: app.appSetting.host + "world/DeleteCollect?worldId=" + e.currentTarget.dataset.worldid+"&userId=" + app.globalData.userInfo.UserId,
      data: {
      },
      header: {
        'content-type': 'application/json' // 默认值
      },
      success: function (res) {

        wx.hideLoading();
        that.requestDataList();

      }
    })
  }

})
